package com.woniuxy.qiantai.consumer;

import com.rabbitmq.client.Channel;
import com.woniuxy.qiantai.config.SendSmsUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;
import java.util.Map;

@Component
public class UserInformationConsumer {
    @RabbitListener(queues = "userInformation")
    public void onMsg(Map<String,String> map, Message message, Channel channel) throws IOException {
        SendSmsUtils.sendAccount(map.get("phoneNumber"), map.get("password"),1747117);

        //确认机制
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
    }
}
